﻿using System.Linq;
using System.Web.Mvc;
using FikriKibar.UI.WebCommon.Infrastructure;

namespace FikriKibar.UI.WebManagement.Controllers
{
    public class LanguageController : FikriKibarController
    {
        #region Methods
        public ActionResult Change(string culture, string returnUrl)
        {
            var path = returnUrl;
            var pathList = path.Split('/').ToList();
            pathList.Remove(pathList[0]);
            var newUrl = "";
            for (var i = 1; i < pathList.Count; i++)
            {
                newUrl += pathList[i] + "/";
            }
            return Redirect("/" + culture + "/" + newUrl);
        }
        #endregion
    }
}